package pers.cz.chat.action;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiFile;

/**
 * @version 1.0
 * @description: 注意需要把鼠标放在一个打开的.java文件上，然后点击左上角file，下的myAction才会弹出消息。
 * @author: ChengZhi 0336
 * @create: 2025-01-24 16:24
 **/
public class MyAction extends AnAction {

	@Override
	public void actionPerformed(AnActionEvent e) {
		Project project = e.getData(PlatformDataKeys.PROJECT);
		PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
		assert psiFile != null;
		String classPath = psiFile.getVirtualFile().getPath();

		Messages.showMessageDialog(project, "guide-idea-plugin-create-project-by-platform: " + classPath, "Hi IDEA Plugin", Messages.getInformationIcon());
	}

}
